#include<iostream>
using namespace std;
void get_next(string s, int next[])
{
	int j = 0;
	int k = -1;
	next[0] = -1;
	while (s[j]!='\0')
	{
		if (k == -1 || s[j] == s[k])
		{
			k++;
			j++;
			next[j] = k;
		}
		else
		{
			k = next[k];
		}
	}
}
int main()
{
	string s1, s2;
	cin >> s1 >> s2;
	int next[300];
	get_next(s2, next);
	int i = 0;
	int j = 0;
	while (i < s1.size() && j < s2.size())
	{
		if (j == -1 || s1[i] == s2[j])
		{
			i++;
			j++;
		}
		else
		{
			j = next[j];
		}
	}
	if (j == s2.size()) {
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
	
	return 0;
}